<?php

if (!defined('TOBBIVM'))
	header('location:/template/notrepassing.php');
/**
 * This file is part of TobbiVMShop.
 *
 * TobbiVMShop is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * TobbiVMShop is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with TobbiVMShop.  If not, see <http://www.gnu.org/licenses/>.
 */
/**
 * set or unset active for category after click in table
 *
 * @version    $Id$
 * @package    TobbiVM-Shop
 * @copyright  Copyright (C) 2012
 * @author     Norbert Gebert
 * @license    GPL3
 */
db::getInstance()->where("category_id", $refValidate->cleanslash($_GET['id']));
$result = db::getInstance()->getOne("category");

if ($result !== NULL)
{
	if ($result['category_active'] === '0')
	{
		$result['category_active'] = '1';
	}
	else
	{
		$result['category_active'] = '0';
	}
	$data = Array('category_active' => $result['category_active']);
	db::getInstance()->where('category_id', $refValidate->cleanslash($_GET['id']));
	db::getInstance()->update('category', $data);
}
else
{
	message::setErrorRow(_('Databaseerror - Contact the Admin!'), true);
}
?>